Skip to content

Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Implement and rewrite tests#1266

Open
mshayriyesaricicek wants to merge 13 commits intoCodeYourFuture:mainfrom
mshayriyesaricicek:implement-rewrite-tests-clean
Open

Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Implement and rewrite tests#1266
mshayriyesaricicek wants to merge 13 commits intoCodeYourFuture:mainfrom
mshayriyesaricicek:implement-rewrite-tests-clean

Conversation

@mshayriyesaricicek
Copy link

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

This pull request practices implementing assertions and the use of Jest.

The functIon are written initially with assertions then re-written using jest.

@mshayriyesaricicek mshayriyesaricicek force-pushed the implement-rewrite-tests-clean branch from 7bec493 to eaaccca Compare March 14, 2026 15:16
@mshayriyesaricicek mshayriyesaricicek added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Mar 14, 2026
@mshayriyesaricicek
Copy link
Author

I've tried reverting but it got very messy with GPT so in the end I made a new branch so that it was clean and not on main.
In Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js I added the other boundary test.
In Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js I grouped the tests together as you suggested.
I have closed the previous pull request Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Implement and rewrite tests
#1230

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 15, 2026
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does not yet have a "Needs Review" label.
I assume you are still working on fixing 3-get-card-value.js based on the suggestions you wrote in the comment.

Note: You might have accidently changed the labels in another PR instead of this one.

expect(getAngleType(1)).toEqual("Acute angle");
expect(getAngleType(45)).toEqual("Acute angle");
expect(getAngleType(89)).toEqual("Acute angle");
expect(getAngleType(91)).toEqual("Obtuse angle");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 91 is checked in case 3, it is optional to check it in this group.

Note: To express, "91 should not be considered as Acute angle", in Jest we could write:
expect(getAngleType(91)).not.toEqual("Acute angle");

@mshayriyesaricicek mshayriyesaricicek added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 16, 2026
Comment on lines +36 to +42
if (card.startsWith("10")) {
firstChar = "10";
suit = card[2]; //if it starts with 10 the third character is the suit
} else {
firstChar = card[0]; //otherwise
suit = card[1]; //the second character is the suit
}
Copy link
Contributor

@cjyuan cjyuan Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test your function with these invalid cases?

getCardValue("2♥2");
getCardValue("2♥♥");

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have amended it to include these as invalid cases too.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@mshayriyesaricicek mshayriyesaricicek added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 18, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Mar 18, 2026

The new implementation works (even though its logic is a bit complicated). Here is an approach for you to review:

// Step 1: Extract `rank` and `suit` from `card`. (We can use `.slice()` to extract each part)

// Step 2: Check if `rank` is one of the 13 possible string values and `suit` is one of the 4 possible characters.

// If the code pass all the checks, then we only need to deal with valid rank from this point onward.
...

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 18, 2026
expect(getAngleType(181)).toEqual("Reflex angle");
expect(getAngleType(270)).toEqual("Reflex angle");
expect(getAngleType(359)).toEqual("Reflex angle");
expect(getAngleType(360))not.toEqual("Reflex angle")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo on line 43.

Doesn't VSCode show .js file with syntax errors in red color?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Structuring-And-Testing-Data The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants